package cn.com.blueInfo.bpm.system.enums;

import cn.com.blueInfo.bpm.common.enums.BaseEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 权限操作
 * @author suxch
 * @since 2025/8/28 22:31
 */
@Getter
@AllArgsConstructor
public enum RoleResourcePermission implements BaseEnum<Integer> {

    /** 权限操作-按钮-可点击 */
    BUTTON_CLICKABLE(1, "按钮-可点击"),
    /** 权限操作-按钮-禁用 */
    BUTTON_DISABLED(0, "按钮-禁用"),

    /** 权限操作-字段-可见 */
    FIELD_VISIBLE(3, "字段-可见"),
    /** 权限操作-字段-隐藏 */
    FIELD_HIDDEN(4, "字段-隐藏");

    @EnumValue
    private final Integer code;

    @JsonValue
    private final String desc;

    public static RoleResourcePermission getByCode(Integer code) {
        return BaseEnum.getByCode(RoleResourcePermission.class, code);
    }

    @JsonCreator
    public static RoleResourcePermission getByName(String name) {
        return BaseEnum.getByName(name, RoleResourcePermission.class);
    }

}
